﻿using Cms.Core.Data.Mapping;
using Cms.Core.Data.Model;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;

namespace Cms.Core.Data.Configurations
{
    public class SysUserConfigurations : EntityMappingConfiguration<SysUser>
    {
    

        public override void Map(EntityTypeBuilder<SysUser> builder)
        {

            base.MapCommon(builder);
            builder.Property(b => b.UserName).HasColumnType("nvarchar(10)").IsRequired(true);
            builder.Property(b => b.AccountNumber).HasColumnType("nvarchar(10)").IsRequired(true);
            builder.Property(b => b.Password).HasColumnType("nvarchar(36)").IsRequired(true);
            builder.Property(b => b.State).HasDefaultValue(0);
            builder.Property(b => b.Sex).HasDefaultValue(0);
            builder.Property(b => b.Age).IsRequired(false);
            builder.Property(b => b.Remarks).HasColumnType("nvarchar(1000)").IsRequired(false);
            builder.Property(b => b.Icon).HasColumnType("nchar(100)").IsRequired(false);
            //builder.Property(b => b.IsAdmin).IsRequired(true).HasDefaultValue(false);
            //builder.HasData(new SysUser { Id= Guid.Parse("D6D0A332-C4A6-4866-718F-08D6A54B4892"),CreateTime=DateTime.Parse("2019-03-10 19:25:55.530"),ModifiedTime=DateTime.Parse("2019-05-01 17:02:21.837"),IsDelete=false, UserName= "管理员",AccountNumber= "admin",Password= "064c5e7d15e7cdd2482077811808e778",State=0,Sex=0,Age=3 })
            builder.ToTable("SysUser");
        }

     
    }
}
